package common.item
{
	import com.common.utils.DisplayObjectUtil;
	import com.liangzhong.constants.TipsConst;
	import com.liangzhong.model.AppData;
	import com.liangzhong.model.playerCenter.vo.PlayerVo;
	import com.lz.football.module.base.IComponent;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.events.MouseEvent;
	
	import lz.controls.ImageContain;
	import lz.controls.managers.TipsManager;
	
	/**
	 * 球员 
	 * @author lake
	 * 
	 */	
	public class LPlayerItem extends BasePlayerItem implements IComponent
	{
		/**
		 *数据 
		 */		
		protected var _data			:*;
		
		/**
		 *设置数据 
		 * @param value
		 * 
		 */		
		public function set data(value :*):void
		{
			_data = value;
			if(_data == null)
			{
				return;
			}
			DisplayObjectUtil.removeAllChildren(_picture);
			var fpv :PlayerVo = _data; 
			var fBitmapData :BitmapData 
			//= AppData.getInstance().shopDataManager.getGoodBitmapDataByUrl(fpv.headurl1);
			if(fBitmapData)
			{
				_picture.addChild(new Bitmap(fBitmapData));
			}
			else
			{
				if(_image == null)
				{
					_image = new ImageContain();
					_image.setSize(50,50);
				}
				_picture.addChild(_image);
//				_image.url = fpv.headurl1;
			}
//			_number.text = fpv.number + "";
//			_place.text = fpv.place + "";
//			_changeBg.gotoAndStop(fpv.colorFrame);
		}
		/**
		 *获取数据 
		 * @return 
		 * 
		 */		
		public function get data():*
		{
			return _data;
		}
		
		public function LPlayerItem()
		{
		}
		/**
		 * 初始化
		 * @param view
		 * 
		 */		
		public function initUI(view:Object=null):void
		{
			this.addChild(_symbolSkin);
			trainIcon.visible = false;
			_frame.visible = false;
			lockIcon.visible = false;
			_number.visible = false;
			_changeBg.gotoAndStop(2);
			addEvtListener();
		}
		/**
		 * 添加事件
		 * 
		 */		
		public function addEvtListener():void
		{
			this.addEventListener(MouseEvent.ROLL_OVER,onRollOver);
			this.addEventListener(MouseEvent.ROLL_OUT,onRollOut);
			
		}
		/**
		 * 移出
		 * @param event
		 * 
		 */		
		private function onRollOut(event:MouseEvent):void
		{
			TipsManager.hide();
		}
		/**
		 * 移上
		 * @param event
		 * 
		 */		
		private function onRollOver(event:MouseEvent):void
		{
			TipsManager.show(TipsConst.PLAYERITEMTIPS,_data,15,15);
		}
		/**
		 * 删除事件
		 * 
		 */		
		public function removeEvtListener():void
		{
			this.removeEventListener(MouseEvent.ROLL_OVER,onRollOver);
			this.removeEventListener(MouseEvent.ROLL_OUT,onRollOut);
		}
		/**
		 * 销毁
		 * 
		 */		
		public function destroyView():void
		{
			removeEvtListener();
			_data = null;
		}
	}
}